package umlproject;

public class imdb {
	Boolean Existence;
	String Title;
	String Year;
	String Rate;
	String Release;
	String Genre;
	String Director;
	String Writer;
	String Actors;
	String Plot;
	String Poster;
	String Runtime;
	String Rating;
	String Id ; 

	
	public imdb decoupeReponseImdb( String reponseImdb){
		String[] decID=new String[2];
		String[] decResp=new String[2];
		//String[] decRating=new String[2];
		String[] decRuntime=new String[2];
		String[] decPoster=new String[2];
		String[] decPlot=new String[2];
		String[] decActors=new String[2];
		String[] decWriter=new String[2];
		String[] decDirector=new String[2];
		String[] decGenre=new String[2];
		String[] decRelease=new String[2];
		String[] decRate=new String[2];
		String[] decYear=new String[2];
		String[] decTitle=new String[2];
		imdb film=new imdb();
		if(reponseImdb.endsWith("ParseError\"}")){
			this.Existence=false;
			this.Title=null;
			this.Year=null;
			this.Rate=null;
			this.Release=null;
			this.Genre=null;
			this.Director=null;
			this.Writer=null;
			this.Actors=null;
			this.Plot=null;
			this.Poster=null;
			this.Runtime=null;
			this.Rating=null;
			this.Id=null;
	}
		else{
			
			decResp=reponseImdb.split("\",\"Resp");
			
			decID=decResp[0].split("\",\"ID\":\"");
			this.Id=decID[1];
			
			
			String[] decRating=decID[0].split("\",\"Rating\":\"");
			this.Rating=decRating[1];
			
			decRuntime=decRating[0].split("\",\"Runtime\":\"");
			this.Runtime=decRuntime[1];
			
			decPoster=decRuntime[0].split("\",\"Poster\":\"");
			this.Poster=decPoster[1];
			
			decPlot=decPoster[0].split("\",\"Plot\":\"");
			this.Plot=decPlot[1];
			
			decActors=decPlot[0].split("\",\"Actors\":\"");
			this.Actors=decActors[1];
			
			decWriter=decActors[0].split("\",\"Writer\":\"");
			this.Writer=decWriter[1];
			
			decDirector=decWriter[0].split("\",\"Director\":\"");
			this.Director=decDirector[1];
			
			decGenre=decDirector[0].split("\",\"Genre\":\"");
			this.Genre=decGenre[1];
			
			decRelease=decGenre[0].split("\",\"Released\":\"");
			this.Release=decRelease[1];
			
			decRate=decRelease[0].split("\",\"Rated\":\"");
			this.Rate=decRate[1];
			
			decYear=decRate[0].split("\",\"Year\":\"");
			this.Year=decYear[1];
			
			decTitle=decYear[0].split("Title\":\"");
			this.Title=decTitle[1];
			this.Existence=true;
		}
	return film;}
}
